#pragma once

#include "ScannerV0.h"
#include "IScanner.h"
#include "IAutomat.h"
#include "IBuffer.h"
#include "ISymtable.h"
#include "IStringTab.h"

const int SCANNED_INT_MAX_LENGTH = 19;

class ScannerImpl : public ScannerV0, public IScanner
{
    IAutomat* automat;
    IBuffer* buffer;
    ISymtable* symtable;
    IStringTab* lexemFrac;
    bool isTokenFound;
    bool isStop;
    //size_t len;
    Token* token;
    unsigned int scanned_row;
    unsigned int scanned_col;
    size_t scanned_integer_len;
    char scanned_integer[SCANNED_INT_MAX_LENGTH + 1];

public:
    ScannerImpl(const char * const srcFile, const char * const dstFile);
    virtual ~ScannerImpl(void);

    //inherited from ScannerV0(aka Scanner)
    virtual Token* nextToken();
    virtual void freeToken(Token token);
    virtual Information lookup(Key key);//clgr selfmade
    virtual SymtabEntry* getSymtabEntry(Key key);

    //inherited from IScanner
    virtual void mkToken(TType type, long long value, unsigned int row, unsigned int col);
    virtual void ungetChar(int times);
    virtual void stop();
    virtual void putCharForInteger(char c);//from clgr
    virtual void putCharForIdentifier(char c);//from clgr
    virtual unsigned int getRow();//from clgr
    virtual unsigned int getCol();//from clgr
};
